package cn.itcast.crm.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.crm.domain.Customer;


public interface CustomerRepository extends JpaRepository<Customer, Integer>,JpaSpecificationExecutor<Customer> {


    @Query
    public List<Customer> findByFixedAreaId(String fixedAreaId);

    @Query(value="update Customer set fixedAreaId=? where id=?")
    @Modifying
    public void updateFixedAreaId(@Param("fixedAreaId") String fixedAreaId, @Param("id") Integer id);

    @Query
    public List<Customer> findByFixedAreaIdIsNull();

}